package services.video;

import com.google.api.client.googleapis.GoogleUrl;
import com.google.api.client.googleapis.GoogleUrl;
import com.google.api.client.util.Key;

/**
 * @author Yaniv Inbar
 */
public class YouTubeUrl extends GoogleUrl {

  /** Whether to pretty print HTTP requests and responses. */
  private static final boolean PRETTY_PRINT = true;

  static final String ROOT_URL = "https://gdata.youtube.com/feeds/api";

  @Key
  public String author;
  
  @Key
  public String q;

  @Key("max-results")
  public Integer maxResults = 2;
  
  @Key("start-index")
  public Integer startIndex = 1;

  public YouTubeUrl(String encodedUrl) {
    super(encodedUrl);
    this.alt = "jsonc";
    this.prettyprint = PRETTY_PRINT;
  }

  private static YouTubeUrl root() {
    return new YouTubeUrl(ROOT_URL);
  }

  public static YouTubeUrl forVideosFeed() {
    YouTubeUrl result = root();
    result.getPathParts().add("videos");
    return result;
  }
}